window.onload = function () {
    console.log("到达nopay_order.js")
    var phone = localStorage.getItem("currentLoginUserPhone.aomall.com");
    console.log(phone);
    let result;
    $.ajax({
            url: "/orders/findAllBySta.do",
            type: "post",
            dataType: "text",
            data: {
                "phone": phone,
                "status": 2
            },
            success: function (resp) {
                result = JSON.parse(resp);
                if (result.code === 200) {
                    console.log("orderall返回成功");
                    console.log(result.data);
                    for (var j = 0; j < result.data.length; j++) {
                        var html = "<div class=\"merchandiseList\">\n" +
                            "\t\t\t\t\t\t\t\t\t<div class=\"ListHead\">\n" +
                            "\t\t\t\t\t\t\t\t\t\t<span>" + result.data[j].orderTime + "</span>\n" +
                            "<span>订单号：<em>"+result.data[j].orderId+"</em></span>\n"+
                            "\t\t\t\t\t\t\t\t\t</div>\n" +
                            "\t\t\t\t\t\t\t\t\t<div class=\"ListArea\">\n" +
                            "\t\t\t\t\t\t\t\t\t\t<ul class=\"ListTable\">\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t<li class=\"one clearfix\">\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\">\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"pruPic\"><img src=\"../images/"+result.data[j].orderDetailList[0].goods.goodsImg+"\" alt=\"\"></div>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"pruTitle\">\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t\t\t"+result.data[j].orderDetailList[0].goods.goodsName+"\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t</a>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"pruNum\">×<i>"+result.data[j].orderDetailList[0].detailNum+"</i></div>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t</li>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t<li class=\"two\">" + result.data[j].orderName + "</li>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t<li class=\"three\">\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t<p>总额￥" + result.data[j].orderPrice + "</p>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t<p>在线支付</p>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t<p>含税/运费：￥" + (parseFloat(result.data[j].orderPrice) * 0.15).toFixed(2) + "</p>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t</li>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t<li class=\"four\">\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t\t<p class=\"ing\">" + result.data[j].status.orderStatusName + "</p>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t</li>\n" +
                            "\t\t\t\t\t\t\t\t\t\t\t<li class=\"five\">\n";
                        var sta = result.data[j].orderStatus;
                        if (sta === 1) {
                            html = html + "\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\">取消订单</a>\n";
                        } else if (sta === 2) {
                            html = html + "\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\">取消订单</a>\n";
                            html = html + "\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\">去付款</a>\n";
                        } else if (sta === 3) {
                            html = html + "\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\">提醒发货</a>\n";
                        } else if (sta === 4) {
                            html = html + "\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\">确认收货</a>\n";
                        } else {
                            html = html + "\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\">删除订单</a>\n";
                            html = html + "\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\">我要评论</a>\n";
                        }
                        html = html + "\t\t\t\t\t\t\t\t\t\t\t</li>\n" +
                            "\t\t\t\t\t\t\t\t\t\t</ul>\n" +
                            "\t\t\t\t\t\t\t\t\t</div>\n" +
                            "\t\t\t\t\t\t\t\t</div>";
                        $(".noPay").append(html);
                    }
                    layer.msg(result.msg);
                } else {
                    // 订单查询失败
                    layer.msg(result.msg);
                }
            }
        }
    )
}
